Skip to main content

Timeout Policies

Timeout policies protect workflows from running indefinitely. A timeout defines the maximum amount of time a workflow or operation is allowed to execute before it is considered to have exceeded its execution limit. Timeouts improve system stability by preventing stalled or excessively long-running tasks from consuming resources indefinitely.

What is a Timeout?

A timeout specifies the maximum execution duration. Conceptually:
If execution exceeds the configured limit, the timeout policy is applied.

Why Use Timeouts?

Not every operation finishes successfully. Sometimes tasks become stuck because of:
  • unresponsive services
  • infinite loops
  • blocked network requests
  • external API delays
  • infrastructure failures
  • unexpected system behavior
Timeouts prevent these situations from affecting the entire workflow.

Execution Timeline

A timeout measures elapsed execution time.
If the task finishes before the limit, execution continues normally.

Timeout Policy

BindAI provides a timeout policy object. Example:
The timeout specifies:
  • maximum execution time
  • behavior after timeout

Successful Completion

If execution completes within the allowed duration:
The timeout policy has no effect.

Timeout Triggered

If execution exceeds the configured limit:
The workflow responds according to the configured policy.

Failing the Workflow

A common configuration is to fail the workflow immediately.
This prevents additional processing after an unrecoverable delay.

Continuing After Timeout

Some workflows may choose not to fail immediately. Conceptually:
This behavior depends on workflow requirements and timeout configuration.

Timeout vs Retry

Timeouts and retries address different concerns. Both policies are often used together.

Timeout vs Loop

Loops intentionally repeat execution. Timeouts prevent excessive execution time.
A timeout provides protection if loop conditions never become false.

Common Use Cases

Timeout policies are useful for:
  • external API calls
  • AI model inference
  • document processing
  • long-running workflows
  • scheduled jobs
  • network communication
  • background automation
Any operation with uncertain execution time can benefit from a timeout.

Combining Policies

Production workflows often combine multiple reliability mechanisms. Example:
This allows temporary problems to recover while preventing indefinite execution.

Monitoring

Timeout events should be monitored in production systems. Useful information includes:
  • execution duration
  • node identifier
  • workflow identifier
  • timeout threshold
  • retry attempts
  • error details
Monitoring helps identify performance bottlenecks.

Best Practices

  • Set realistic timeout values.
  • Use shorter timeouts for external services.
  • Combine timeouts with retry policies.
  • Monitor timeout frequency.
  • Avoid excessively large timeout limits.
  • Design workflows so interrupted tasks can be restarted safely when appropriate.

Summary

Timeout policies protect BindAI workflows from stalled or excessively long-running execution. By limiting execution duration, they improve system stability, prevent resource exhaustion, and provide predictable behavior when operations fail to complete within acceptable time limits.